using System;
using System.Runtime.InteropServices;
using System.Security;
using System.Windows.Forms;

namespace SharpWindServer
{
	public static class Win32
	{
		[StructLayout( LayoutKind.Sequential )]
		public struct PeekMsg
		{
			public IntPtr hWnd;
			public Message msg;
			public IntPtr wParam;
			public IntPtr lParam;
			public uint time;
			public System.Drawing.Point p;
		}

		[SuppressUnmanagedCodeSecurity]
		[DllImport( "User32.dll", CharSet = CharSet.Auto )]
		public static extern bool PeekMessage( out PeekMsg msg, IntPtr hWnd, uint messageFilterMin, uint messageFilterMax, uint flags );

		public static bool AppStillIdle
		{
			get
			{
				PeekMsg msg;
				return !PeekMessage( out msg, IntPtr.Zero, 0, 0, 0 );
			}
		}
	}
}
